<template>
  <div class="scroll">
    <div class="button">
      <el-button>scroll</el-button>
    </div>
    <div @click="moveOther" class="ssss">dddd</div>
  </div>
</template>

<script lang="ts">
import { Component, Vue } from 'vue-property-decorator';

@Component({
  components: {}
})
export default class Home extends Vue {
  ele: any;
  mounted() {
    this.ele = document.querySelector('.button');
    console.log(this.ele);
  }

  // 测试元素将与其所在滚动区的可视区域最近的边缘对齐
  // 测试元素将与其所在滚动区的可视区域最近的边缘对齐
  moveOther() {
    setTimeout(() => {
      this.ele.scrollIntoView({ behavior: 'smooth', block: 'end', inline: 'nearest' });
    }, 500);
  }
}
</script>
<style>
.scroll {
  height: 1000px;
}
.ssss {
  margin-top: 600px;
}
</style>
